package com.dragon.service.impl;

import com.dragon.common.vo.PageBean;
import com.dragon.dao.UserDao;
import com.dragon.entity.User;
import com.dragon.service.intf.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    private final UserDao userDao;

    public UserServiceImpl(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void add(User user) {

    }

    @Override
    public PageBean queryAll(int page, int limit) {
        PageHelper.startPage(page, limit);
        PageInfo<User> userPageInfo = new PageInfo<>(userDao.selectAll());
        return new PageBean(userPageInfo.getTotal(), userPageInfo.getList());
    }
}
